<?php

include "fonctions.php";
head_html("Gestion des jeux");
echo "<script type=\"text/javascript\" src=\"./gerer_jeux.js\"></script>";
en_tete();
?>

	<div id="contenu">
		<?php
			menu_lateral_droit();
		?>
		<div id="texte">
			<?php
			vousetesici("G&eacuterer les jeux");
			db_connect();
			echo "<h1>Cadavre excquis</h1>";
			echo "<table id=\"myTable\" class=\"tablesorter\"> 
				<thead> 
				<tr> 
				    <th>Nom</th> 
				    <th>Nom atelier</th> 
				    <th>Vitrine</th>
				    <th>Terminer</th>
				</tr> 
				</thead> 
				<tbody> ";
		
			$req_cad ="SELECT * FROM LMLP.cadavre_exquis as exc , LMLP.ateliers as ate, LMLP.exercices as exe,LMLP.exercices_ateliers as exo WHERE exe.etat=\"actif\" and exc.idExercice = exo.idExercice and exo.nomAtelier = ate.nomAtelier and exe.idExercice = exc.idExercice;";
			$result_cad = mysql_query($req_cad) or die (mysql_error());
			$nb = mysql_num_rows($result_cad);
		
			while ($row = mysql_fetch_assoc($result_cad)) {
			
			    echo "<tr>";
			    echo "<td>".$row['nom']."</td>";
			    echo "<td>".$row['nomAtelier']."</td>";
			    echo "<td>";
			    if($row['vitrine']==1){
			    	    echo"<select onchange=\"modifier_vitrine(".$row['idExercice'].")\" id=\"".$row['idExercice']."\">
						<option selected value=\"true\">True</option>
						<option value=\"false\">False</option>
					</select>";
			    }else{
			    	    echo"<select onchange=\"modifier_vitrine(".$row['idExercice'].")\" id=\"".$row['idExercice']."\">
						<option value=\"false\">False</option>
						<option value=\"true\">True</option>

					</select>";
			    }         
			    echo "</td>";
			     echo "<td>
			     	<input type=\"button\" name=\"Ok\" value=\"Ok\" onclick=\"fin(".$row['idExercice']."); \" />
			      </td>";
			    echo "</tr>";
			}
				
		
		?>
		</tbody> 
		</table>
				
			
		<div id="error">
		</div>		
			
		</div>
	</div>
	<?php
		pied_page();
	?>
</body>
</html>
